<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>  
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">

<title>上传文件演示</title>
<link href="${pageContext.request.contextPath}/css/bootstrap.min.css?v=3.3.7" rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/font-awesome.min.css?v=4.6.3" rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/plugins/bootstrap-table/bootstrap-table.min.css?v=1.11.0" rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/animate.min.css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/style.css?v=${cver}" rel="stylesheet">

<script type="text/javascript">
var contextPath = '${pageContext.request.contextPath}';
</script>
</head>

<body class="white-bg">
	<div class="container animated fadeInLeft">
		<div class="ibox-title">
			<h5>上传文件演示 <small>基础信息</small></h5>
		</div>
		<div class="ibox-content">
			<form id="contentForm" method="post" class="form-horizontal">
				<input type="hidden" name="fid" value="${m.fid}">
				<div class="row">
					<div class="form-group">
	                    <label class="col-sm-2 control-label">文件名称：</label>
	                    <div class="col-sm-10">
	                        <p class="form-control-static">${m.fname}</p>
	                    </div>
	                </div>
	            </div>
	            <div class="hr-line-dashed"></div>
				<div class="row">
					<div class="form-group">
	                    <label class="col-sm-2 control-label">文件查看路径：</label>
	                    <div class="col-sm-10">
	                        <p class="form-control-static">${m.furl}</p>
	                    </div>
	                </div>
	            </div>
	            <div class="hr-line-dashed"></div>
				<div class="row">
					<div class="form-group">
	                    <label class="col-sm-2 control-label">文件下载路径：</label>
	                    <div class="col-sm-10">
	                        <p class="form-control-static">${m.downloadUrl}</p>
	                    </div>
	                </div>
	            </div>
	            <div class="hr-line-dashed"></div>
				<div class="row">
					<div class="form-group">
	                    <label class="col-sm-2 control-label">创建时间：</label>
	                    <div class="col-sm-10">
	                    	<fmt:formatDate value="${m.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
	                    </div>
	                </div>
	            </div>
	            <div class="hr-line-dashed"></div>
				<div class="row">
					<div class="form-group">
	                    <label class="col-sm-2 control-label">创建用户：</label>
	                    <div class="col-sm-10">
	                        <p class="form-control-static">${m.updateUser}</p>
	                    </div>
	                </div>
	            </div>
	            <div class="hr-line-dashed"></div>
				<div class="row">
					<div class="form-group">
	                    <label class="col-sm-2 control-label">附件列表：</label>
	                    <div class="col-sm-10">
	                        <table id="attachTable" style="width: 2000px">
							</table>
	                    </div>
	                </div>
	            </div>
			</form>
		</div>
	</div>
	

	<script src="${pageContext.request.contextPath}/js/jquery.min.js?v=2.1.4"></script>
	<script src="${pageContext.request.contextPath}/js/bootstrap.min.js?v=3.3.7"></script>
	<script src="${pageContext.request.contextPath}/js/plugins/bootstrap-table/bootstrap-table.min.js?v=1.11.0"></script>
	<script src="${pageContext.request.contextPath}/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js?v=1.11.0"></script>
	
	<script type="text/javascript" src="${pageContext.request.contextPath}/lib/zymvc-2.0.min.js"></script>
	
	<script type="text/javascript">
	function download(val){
		//alert(val)
		open(val)
	}
	$(document).ready(function () {
		//显示附件列表
		var $columns = [
	        {title: '文件id', field: 'id', visible: false},
	        {title: '文件名称', field: 'picname'},
	        {title: '文件路径', field: 'picurl',
	        	formatter: function(value, row, index) {
	        		return "<button type='button' class='btn btn-primary btn-sm' onclick=download('"+value+"')>下载</button>";
	        	}
	        }
	    ];
		$attachTable = mvc.bootstrap.pageTable({
			url: '/api/example/file/exampleUploadFile/doListAttach?bid=${m.fid}',//查询接口
			table: '#attachTable',//展示列表
			height: 300,
			columns: $columns
		})
	})
	</script>
</body>

</html>